<template>
  <van-cell class="house-item" @click="goDetail">
    <template #title>
      <van-image fit="fill" :src="imgBaseURL + obj.houseImg" />
    </template>
    <!-- 右侧标题 -->
    <h3 class="house-item-title house-item-commons" v-if="obj.title">
      {{ obj.title }}
    </h3>
    <!-- 描述 -->
    <div class="house-item-desc house-item-commons">{{ obj.desc }}</div>
    <!-- 优点 -->
    <div class="house-item-commons">
      <span
        v-for="(item, index) in obj.tags"
        :key="index"
        class="house-item-tag"
        >{{ item }}</span
      >
    </div>
    <!-- 租金 -->
    <div class="house-item-price">
      <span class="house-item-price-num">{{ obj.price }}</span> 元/月
    </div>
  </van-cell>
</template>

<script>
export default {
  name: '',
  components: {},
  props: {
    obj: Object
  },
  data() {
    return {
      imgBaseURL: 'http://liufusong.top:8080'
    }
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    // 带参跳转
    goDetail() {
      this.$router.push('/detail/' + this.obj.houseCode)
    }
  }
}
</script>

<style scoped lang="less">
.house-item {
  height: 120px;
  padding: 18px 0 0;
  border-bottom: 1px solid #e5e5e5;
  // 左侧
  .van-cell__title {
    flex: unset;
    .van-image {
      width: 106px;
      height: 80px;
    }
  }
  // 右侧
  .van-cell__value {
    padding-left: 12px;
    text-align: left;
    line-height: 22px;
    // 公共部分
    .house-item-commons {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      vertical-align: middle;
    }
    // 标题
    .house-item-title {
      margin: 0;
      font-size: 15px;
      color: #394043;
    }
    // 描述
    .house-item-desc {
      font-size: 12px;
      color: #afb2b3;
    }
    // 优点
    .house-item-tag {
      display: inline-block;
      font-size: 12px;
      border-radius: 3px;
      padding: 4px 5px;
      margin-right: 5px;
      line-height: 12px;
      color: #39becd;
      background: #e1f5f8;
    }
    // 租金
    .house-item-price {
      // line-height: 23px;
      font-size: 12px;
      color: #fa5741;
      .house-item-price-num {
        font-size: 16px;
        font-weight: bolder;
      }
    }
  }
}
</style>
